package com.tuanzi.loan.business.service.businesssystem.impl;

import com.tuanzi.loan.business.entity.businesssystem.BusinessProduct;
import com.tuanzi.loan.business.entity.family.ProductInfo;
import com.tuanzi.loan.business.repository.businesssystem.BusinessProductRepository;
import com.tuanzi.loan.business.service.businesssystem.BusinessProductService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.repository.JPAAuditRepository;
import com.tuanzi.loan.core.service.BaseAuditServiceImpl;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.businesssystem.BusinessProductRequest;
import com.tuanzi.loan.vo.response.businesssystem.BusinessProductResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Debug
@Service
@Transactional
@Retryable(value = {RetryException.class})
public class BusinessProductServiceImpl extends BaseAuditServiceImpl<BusinessProduct,Long> implements BusinessProductService {
    @Autowired
    private BusinessProductRepository settlementProductRepository;
    @Override
    public Page<BusinessProductResponse> list(PageSearcher<BusinessProductRequest> pageSearcher) {
        return settlementProductRepository.list(pageSearcher.getSearchCondition(),pageSearcher.getPageable());
    }

    @Override
    public List<ProductInfo> getActivityList() {
        return settlementProductRepository.getActivityList();
    }

    @Override
    public List<BusinessProduct> getProductList() {
        return settlementProductRepository.getProductList();
    }

    @Override
    protected JPAAuditRepository<BusinessProduct, Long> getRepository() {
        return settlementProductRepository;
    }
}
